package com.zc.basic.app.controller;

import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zc.basic.app.service.PcmcRoleService;
import com.zc.basic.domain.pojo.PcmcRole;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/role")
public class RoleController {

    @Autowired
    private PcmcRoleService pcmcRoleService;

    @PostMapping("/list")
    public Page<PcmcRole> queryPageRoles(@RequestParam int pageNo, int pageSize, @RequestBody String reqBody) {
        Page<PcmcRole> page = new Page<>(pageNo, pageSize);
        Wrapper wrapper = new QueryWrapper(JSON.parseObject(reqBody, PcmcRole.class));
        Page<PcmcRole> pageData = pcmcRoleService.page(page, wrapper);
        return pageData;
    }


}
